package com.sense.kukoo.biz_library.model

import com.sense.kukoo.biz_library.net.LibraryHttpApi
import com.sense.kukoo.common.mvvm.model.BaseMvvmModel
import com.sense.kukoo.common.repo.bean.BookItemBean
import com.sense.kukoo.common.repo.bean.LibrarySubscriptionBean
import com.sense.kukoo.common.repo.bean.QueryPageBean
import com.sense.kukoo.common.repo.bean.ResultBean
import com.sense.kukoo.common.repo.http.KukooHttpManager

class MySubscriptionsModel:BaseMvvmModel() {

    private val TAG: String = javaClass.simpleName
    override fun onModelCleared() {}

    suspend fun subscription(bookId: String): ResultBean<Boolean> {
        return KukooHttpManager.instance.createHttpClient(LibraryHttpApi::class.java).subscription(bookId)
    }

    /*suspend fun subscriptionQueryItemPage(pageIndex: Int, pageSize: Int): ResultBean<QueryPageBean<BookItemBean>> {
        return KukooHttpManager.instance
            .createHttpClient(LibraryHttpApi::class.java)
            .subscriptionQueryItemPage(""+pageIndex, ""+pageSize)
    }*/

    //订阅记录，同订阅页面的channel
    suspend fun subscriptionQueryPage(pageIndex: Int, pageSize: Int): ResultBean<QueryPageBean<LibrarySubscriptionBean>> {
        return KukooHttpManager.instance
            .createHttpClient(LibraryHttpApi::class.java)
            .subscriptionQueryPage(""+pageIndex, ""+pageSize)
    }
}